public class test {
    public static void main(String[] args) {
        //计算1/1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100 的值    。
        float i = 1;
        float sum = 0;
        for (float j = 1; j <= 100; j++) {
            sum += (1/j)*i;
            i *= -1;
        }
        System.out.println("和是："+ sum);
    }
}
